package com.exthirteen.textgamescript.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * <p>
 * JSON枚举序列化
 * </p>
 *
 * @author exthirteen
 * @since 2021-11-20
 */
public class BaseEnumSerializer extends JsonSerializer<IEnum<?>>{

    @Override
    public void serialize(IEnum<?> value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeObject(value.getId());
    }

}
